home *** CD-ROM | disk | FTP | other *** search
- unit CustomMsgU;
-
- interface
-
- uses
- Windows;
-
- type
- TBroadcastSystemMsgFunc = function (Flags: DWORD; Recipients: PDWORD;
- uiMessage: UINT; wParam: WPARAM; lParam: LPARAM): Longint; stdcall;
-
- var
- wm_ClinicMessage: UInt;
- BroadcastSystemMsg: TBroadcastSystemMsgFunc;
-
- implementation
-
- uses
- SysUtils;
-
- {$ifdef Ver90}
- //These variables did not exist until Delphi 3
- var
- Win32Platform: Integer = 0;
- Win32MajorVersion: Integer = 0;
- Win32MinorVersion: Integer = 0;
-
- procedure InitPlatformId;
- var
- OSVersionInfo: TOSVersionInfo;
- begin
- OSVersionInfo.dwOSVersionInfoSize := SizeOf(OSVersionInfo);
- if GetVersionEx(OSVersionInfo) then
- with OSVersionInfo do
- begin
- Win32Platform := dwPlatformId;
- Win32MajorVersion := dwMajorVersion;
- Win32MinorVersion := dwMinorVersion;
- end;
- end;
- {$endif}
-
- procedure InitBroadcastMsgPtr;
- const
- APIName: array[Boolean] of PChar =
- ('BroadcastSystemMessageA', 'BroadcastSystemMessage');
- var
- InWin95: Boolean;
- begin
- //Running under Windows 95?
- InWin95 := (Win32Platform = VER_PLATFORM_WIN32_WINDOWS) and
- (Win32MajorVersion = 4) and (Win32MinorVersion = 0);
- @BroadcastSystemMsg :=
- GetProcAddress(GetModuleHandle(Windows.User32), APIName[InWin95])
- end;
-
- initialization
- wm_ClinicMessage := RegisterWindowMessage('MyUniqueString!!!');
- {$ifdef Ver90}
- InitPlatformId;
- {$endif}
- InitBroadcastMsgPtr
- end.
-